﻿#region Usings

using System.Data.Entity.ModelConfiguration;
using Rail.Net.Core.Model;

#endregion

namespace Rail.Net.Data.Configuration
{
    public class PriceDomesticMap : EntityTypeConfiguration<PriceDomestic>
    {
        public PriceDomesticMap()
        {
            ToTable("PriceDomestics");
            HasKey(priceDomestic => priceDomestic.Id);

            Property(priceDomestic => priceDomestic.TarifNumber).IsRequired();
            Property(priceDomestic => priceDomestic.SubRu).IsRequired().HasMaxLength(2);
            Property(priceDomestic => priceDomestic.Class).IsRequired().HasMaxLength(1);
            Property(priceDomestic => priceDomestic.ZoneFrom).IsRequired();
            Property(priceDomestic => priceDomestic.ZoneTo).IsRequired();
            Property(price => price.Price).IsRequired().HasPrecision(18, 2);
            Property(priceDomestic => priceDomestic.ValidFrom).IsRequired();
            Property(priceDomestic => priceDomestic.ValidTo).IsRequired();
        }
    }
}